//
//  CourseDetailModel.m
//  ShowYork
//
//  Created by hxh on 2020/9/2.
//  Copyright © 2020 hxh. All rights reserved.
//

#import "LessonDetailModel.h"

@implementation LessonDetailModel


- (CGSize)lessonSize{
    
    
    // 默认左右间距
    CGFloat margin = 16;
    // 确定按钮的宽度
    CGFloat confirmBtnW = 80;
    // 获取视频高度
    CGFloat videoH = kScreenW/16*9;
    
    //
    CGFloat totalMargin = 24 + 8 + 16;
    
    
    // 获取文字高度
    CGFloat lessonTitleH = [RPAppManager getTextSizeWithText:self.lesson.title font:font(20) maxSize:CGSizeMake(kScreenW - 3 * margin - confirmBtnW ,MAXFLOAT)].height;
    // 获取描述文字高度
    CGFloat lessonDescH = [RPAppManager getTextSizeWithText:self.lesson.intro font:font(14) maxSize:CGSizeMake(kScreenW - 2 * margin, MAXFLOAT)].height;
    if (self.lesson.intro.length == 0) {
        lessonDescH = 0;
        totalMargin = 24 + 16;
    }
    return CGSizeMake(kScreenW, videoH + lessonDescH + lessonTitleH + totalMargin);
}

- (CGSize)teacherSize{
    CGFloat margin = 16;
    CGFloat teacherIconH = 60;
    return CGSizeMake(kScreenW, margin + teacherIconH);
}
- (CGSize)recommendSize{
    // 默认左右间距
    CGFloat margin = 16;
    CGFloat itemRate = 190.0/165.0f;
    CGFloat itemW = (kScreenW - margin * 3)/2;
    CGFloat itemH = itemW * itemRate;
    return CGSizeMake(itemW, itemH);
}
- (CGSize)afterClassSize{
    CGFloat margin = 16;
    CGFloat buttonH = 30;
    return CGSizeMake(kScreenW, margin * 2 + buttonH);
}

@end
